/*cnpm install express --save   
  cnpm install mysql --save 
  cnpm install cors --save
  cnpm i -g nodemon
  cnpm i multer --save*/

var Express = require('express')
var cors=require('cors')

const bodyParse = require('body-parser');
var multer = require('multer');

// 需要自行编写
const empRouter = require('./router/basic/employee')
const roleRouter = require('./router/system/role')
const userRouter = require('./router/system/user')
const cakeRouter = require('./router/basic/cake')

var app = new Express();
app.use(cors());
app.use(bodyParse.urlencoded({ extended: false }))
app.use(bodyParse.json());
app.use(multer({ dest: './upload/' }).any())

//自行编写
app.use('/emp',empRouter);
app.use('/role',roleRouter)
app.use('/user',userRouter);
app.use('/cake',cakeRouter);

var server=app.listen('3000','localhost',function (req,res) {

    var host= server.address().address;
    var post=server.address().port;

    console.log('the server in running on http://%s:%s',host,post);

})
